package types

import (
	"database/sql/driver"
	"fmt"
	"strconv"
)

type Duration int64

func (p *Duration) Scan(src interface{}) error {
	v, _ := strconv.ParseInt(fmt.Sprintf("%v", src), 10, 64)
	*p = Duration(v)
	return nil
}

func (p Duration) Value() (driver.Value, error) {
	return driver.Value(int64(p)), nil
}